// 补全句号
const input = 'Alice and bob love program I think so too This is great thanks very much';

const output = 'Alice and bob love program. I think so too. This is great thanks very much.';

function addPeriod (input) {
    return input.replace(/\s[A-Z]/g, item => '.' + item) + '.';
}

console.log(addPeriod(input));
